<?php
class Article
{
    public static function get($id)
    {
        return Db::get(__CLASS__)->select()->where(array('_pk'=>$id))->getOne();
    }

    public static function getList($where, $s=0, $l=0)
    {
        return Db::get(__CLASS__)->select()->where($where)->order('aid DESC')->limit($s, $l)->getAll();
    }
    public static function count($where)
    {
        return Db::get(__CLASS__)->count()->where($where)->getCol();
    }

    public static function add($data)
    {
        return Db::get(__CLASS__)->insert($data)->exec() ? Db::get(__CLASS__)->insertId() : false;
    }
    public static function update($id, $data)
    {
        return Db::get(__CLASS__)->update($data)->where(array('_pk'=>$id))->exec();
    }
    public static function delete($id)
    {
        return Db::get(__CLASS__)->delete()->where(array('_pk'=>$id))->exec();
    }

}
?>